package com.sduept.zj103.model;

import com.alibaba.fastjson.JSONObject;
import org.tio.client.ClientChannelContext;
import org.tio.core.intf.Packet;

import java.util.*;

public class Zj103Protocol extends Packet{
    public int sendIFrameNo; //发送I帧序号
    public int recvIFrameNo; //接收I帧序号
    public int asduAddr;
    public Apdu inApdu;
    public Apdu outApdu;
    public ClientChannelContext clientChannelContext = null;

    public Map<Integer, FileListInfo> fileListMap; //rii, 文件列表
    public Map<Integer, FileData> fileDataMap; //rii, 录波文件
    public Map<Integer, Telecommand> telecommandMap; //inf, 遥信开关量，录波器通信状态
    public Map<Integer, Date> devTimeMap; //rii, 设备时间
    public Map<Integer, JSONObject> rpcReqMap; //同步远程rpc调用
    public Map<String, JSONObject> allRpcFileReqMap; //所有的远程rpc文件调用
    private int rii;

    public Zj103Protocol() {
        sendIFrameNo = 0;
        recvIFrameNo = 0;
        inApdu = new Apdu();
        outApdu = new Apdu();
        fileListMap = new HashMap<>();
        fileDataMap = new HashMap<>();
        rpcReqMap = new HashMap<>();
        allRpcFileReqMap = new HashMap<>();
        asduAddr = 1;
        rii = 0;
    }

    public int getRii() {
        rii++;
        return rii;
    }
}
